package org.zzz.controller;

import org.zzz.entity.Teacher;
import org.zzz.entity.TeacherVo;
import org.zzz.service.TeacherService;
import org.zzz.service.impl.TeacherServiceImpl;
import org.zzz.utils.Result;

import java.util.List;

/**
 * @Author ZZF
 * @Time 2021/04/20 23:00
 */
public class TeacherController {
    private TeacherService teacherService = new TeacherServiceImpl();

    /**
     * 获取所有老师信息
     * @return
     */
    public Result<List<Teacher>> listAllTeacher(){
        List<Teacher> teacherList = teacherService.listAllTeacher();
        return teacherList != null ? Result.success("查询成功").data(teacherList) : Result.error("暂无数据");
    }

//    /**
//     * 根据教师工号查询教师信息
//     * @param id
//     * @return
//     */
//    public Result<Teacher> getTeacherById(String id){
//        Teacher teacher = teacherService.getTeacherById(id);
//        return teacher != null ? Result.success("查询成功").data(teacher) : Result.error("查无此数据");
//    }

    /**
     * 根据教师名称查询教师信息
     * @param name
     * @return
     */
    public Result<List<Teacher>> getTeacherByName(String name){
        List<Teacher> teacherList = teacherService.getTeacherByName(name);
        return teacherList != null ? Result.success("查询成功").data(teacherList) : Result.error("查无此数据");
    }
}
